package HibernateSQLite.java.model;
import java.io.Serializable;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Influence implements Serializable , Comparable<Influence>{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private long influence_id = 1L;
	private String OP_principal;
	private String coupe;	
	private String OP_influence_1;
	private String OP_influence_2;
	private long InformationLigne_id;
	
	public long getInfluence_id() {
		return influence_id;
	}
	public void setInfluence_id(long influence_id) {
		this.influence_id = influence_id;
	}
	public String getCoupe() {
		return coupe;
	}
	
	
	public String getOP_principal() {
		return OP_principal;
	}
	public void setOP_principal(String oP_principal) {
		OP_principal = oP_principal;
	}
	public void setCoupe(String coupe) {
		this.coupe = coupe;
	}
	public String getOP_influence_1() {
		return OP_influence_1;
	}
	public void setOP_influence_1(String oP_influence_1) {
		OP_influence_1 = oP_influence_1;
	}
	public String getOP_influence_2() {
		return OP_influence_2;
	}
	public void setOP_influence_2(String oP_influence_2) {
		OP_influence_2 = oP_influence_2;
	}
	public long getInformationLigne_id() {
		return InformationLigne_id;
	}
	public void setInformationLigne_id(long informationLigne_id) {
		InformationLigne_id = informationLigne_id;
	}

	
	@Override
	public int compareTo(Influence inf) {
		Pattern p = Pattern.compile("[0-9]{1,3}");
		Matcher m = p.matcher(this.coupe);
		Matcher m2 = p.matcher(inf.coupe);
		m.find();
		m2.find();
		
		return (new Integer(m.group(0))).compareTo((new Integer(m2.group(0))));

		//return this.coupe.compareTo(inf.coupe);
	}
	
	
}
